<?php

namespace app\common\controller;

use app\common\library\Auth;
use think\Controller;
use think\Request;
use think\Session;
use think\Url;

/**
 * API控制器基类
 */
class Mobile extends Controller
{

    /**
     * 构造方法
     * @access public
     * @param Request $request Request 对象
     */
    public function __construct(Request $request = null)
    {
    	if($request->param('token')) {
    		Session::set('token', $request->param('token'));
    		//根据token查找merid
    		$auth = Auth::instance();
    		$auth->init($request->param('token'));
        }
        
        //来源如果为app，隐藏头部
	    if($request->param('source')) {
		    Session::set('source', $request->param('source'));
	    }
	
	    //推荐人手机号
	    if($request->param('rmobile')) {
		    Session::set('rmobile', $request->param('rmobile'));
	    }
	    
	    
	    parent::__construct();
    }

}
